Component({
  mixins: [],
  data: {
    animation:'',
		likeArr:[],
		// bg:{
		// 	url:'https://img.alicdn.com/imgextra/i3/4161056916/O1CN01T6AaGm20xZqitBbtY_!!4161056916.png'
		// },

		// shopBgt:{
		// 	url:'https://img.alicdn.com/imgextra/i2/4161056916/O1CN01beVV8l20xZqoPWZvN_!!4161056916.png'
		// },
  },
  props: {

    collectionBtn:"" ,   //收藏按钮

  },
  onInit(){

    this.setData({
      ...getApp().pifu.collectionPage,
      goods:this.props.goods
    })
  },
  didMount() {

    this.$page.collectionPage=this;

    this.animation = my.createAnimation();

    this.animation.translate('0%','150%').step()
    this.setData({ animation: this.animation.export() })

    this.isCollect();

    

  },
  didUpdate() {},
  didUnmount() {},
  methods: {

    // status(o){
    //   this.setData({
    //     goods:o
    //   })
		// },

		//关闭
    closeList(){
      
      this.animation.translate('0%','-150%').step()
      this.setData({ animation: this.animation.export() })

      setTimeout(() => {
        this.$page.setData({
          isScroll:false,
          isShowCollection:false
        })
      }, 400);
    },

    // 是否收藏
    isCollect(){
			console.info(11)
      let newlikeA=[]
      for(let i in this.data.goods){
        newlikeA.push(0)
      }
      this.setData({likeArr:newlikeA})
      for(let i in this.data.goods){
        my.tb.checkGoodsCollectedStatus({
          id: this.data.goods[i].id,
          success: (res) => {
            res.isCollect && (newlikeA[i]=1)
            this.setData({likeArr:newlikeA})
          },
          fail: (res) => {
              
          }
        })
      }
       
    },


    collection(e){

      // console.log(e.currentTarget.dataset.id);
      // console.log(e.currentTarget.dataset.status);

      if(e.currentTarget.dataset.status) return

      
      this.$page.collection(e.currentTarget.dataset.id)
     
      
    },

   

  },
});
